<?php
 
include 'jssdk.php'; 
header('Content-Type:application/json; charset=utf-8');
$msg="ok";
if($_COOKIE["username"]==null) {
    $msg="no username cookie value";
    $arr = array('stat'=>'error','msg'=>$msg);
    exit(json_encode($arr));
}

if(!isset($_POST['serviceid'])){
    $msg="no serviceid";
    $arr = array('stat'=>'error','msg'=>$msg);
    exit(json_encode($arr));
}


$jssdk=new JSSDK("xx","xx");
//根据post来的图片serviceid存保图片，返回图片文件名
$filename=$jssdk->getWxImage($_POST['serviceid']);
$msg=$filename; 

$arr = array('stat'=>'ok','msg'=>$msg);
//输出JSON数据
exit(json_encode($arr));
?>